import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'mic_resource_setting_page_model.dart';

///
/// 边框选择
///
class MicResourceListPage extends StatefulWidget {
  int position;
  MicResourceSettingPageModel model;

  MicResourceListPage({required this.position, required this.model});

  @override
  State<MicResourceListPage> createState() => _MicResourceListPageState();
}

class _MicResourceListPageState extends State<MicResourceListPage>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider.value(value: widget.model),
      ],
      child: Consumer<MicResourceSettingPageModel>(
          builder: (context, model, child) {
        return _buildContent(context, model);
      }),
    );
  }

  Widget _buildContent(
      BuildContext context, MicResourceSettingPageModel model) {
    return Container(
      width: double.infinity,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(16),
        color: Colors.white,
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const SizedBox(
            height: 20,
          ),
          const Align(
            alignment: Alignment.topCenter,
            child: Text(
              // T.current!.some_position_mic_seat_frame(widget.position + 1),
              'some_position_mic_seat_frame',
              style: TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.w600,
                color: Color(0xff333333),
              ),
            ),
          ),
          const SizedBox(
            height: 20,
          ),
          ListView.builder(
              shrinkWrap: true,
              physics: const NeverScrollableScrollPhysics(),
              itemCount: 1,
              itemBuilder: (context, index) {
                return InkWell(
                  onTap: () {
                    // model.updateSettingItem(context, widget.position,
                    //     model.data!.configItem[index]);
                  },
                  child: Ink(
                    height: 52,
                    child: const Row(
                      children: [
                        SizedBox(
                          width: 30,
                        ),
                        Expanded(
                            child: Text(
                          // (model.data!.configItem[index].name.isEmpty)
                          //     ? T.current!.no_seat_frame
                          //     : model.data!.configItem[index].name,
                          ' T.current!.no_seat_frame',
                          style: TextStyle(
                            fontSize: 13,
                            fontWeight: FontWeight.w500,
                            color: Color(0xff333333),
                          ),
                        )),
                        // Icon(
                        //   Icons.check_circle,
                        //   color: (model.configMap[widget.position]?.id ==
                        //           model.data!.configItem[index].id)
                        //       ? const Color(0xFFFFD400)
                        //       : const Color(0xFFE0E0E0),
                        // ),
                        SizedBox(
                          width: 30,
                        ),
                      ],
                    ),
                  ),
                );
              })
        ],
      ),
    );
  }
}
